UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G5PaSoQI1ToXPLuSTyPjzOaFa0R9+uJA6RjqzKg56yo=' 
WHERE 
  key_id = 'b493fe31595fb27defa8efe97175d168e10539a44a57feb2157ab663b83c5373' 
  AND (
    token = 'G5PaSoQI1ToXPLuSTyPjzOaFa0R9+uJA6RjqzKg56yo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024