UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+1a7V823oAaUC6Yu5Jiu2XkANIRUPKXN+du0jo/D9+Q=' 
WHERE 
  key_id = '4f182603eca46a30b9be30d95cc92c1baed609a7c30a617d49d8646da0d3c798' 
  AND (
    token = '+1a7V823oAaUC6Yu5Jiu2XkANIRUPKXN+du0jo/D9+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047