UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P/5OCfOLyg4wDxPen3w6nKOQ44pOnzdmeJHwdKvmR/Q=' 
WHERE 
  key_id = '7f79111a74fe035ec5918c4b81297ad578a4c8f7545d1b74eaa1270ebafd1126' 
  AND (
    token = 'P/5OCfOLyg4wDxPen3w6nKOQ44pOnzdmeJHwdKvmR/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041