UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bEENvnoHO9MV/d2jn3KmmbwvW1qUg4uyRDOlM/Zb1jM=' 
WHERE 
  key_id = 'c894d80facebec4462528ea16bd968f1461e59e60653d29f606ab27b7f35abd4' 
  AND (
    token = 'bEENvnoHO9MV/d2jn3KmmbwvW1qUg4uyRDOlM/Zb1jM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031