UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lcocxVZL9+PxlNYcRYNqj9WzDQHfSKzfkOKmXh7dBm4=' 
WHERE 
  key_id = '39e823942d53360bb65bc934b4d17d7cc06154530fb7448f80fd92ed3faea7d5' 
  AND (
    token = 'lcocxVZL9+PxlNYcRYNqj9WzDQHfSKzfkOKmXh7dBm4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040