UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eNke4sQm1m4zXDj08TZ4YgcxGSytmatxIXu1xkhgxkY=' 
WHERE 
  key_id = 'f38bbae7b1b4dc03fb67e9e25949876e552011623e87d72c54d96ee7169a483c' 
  AND (
    token = 'eNke4sQm1m4zXDj08TZ4YgcxGSytmatxIXu1xkhgxkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034