UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vivJeERu1zORDxoGfubwclNV4cc7TM05tsm4xA/oT5c=' 
WHERE 
  key_id = 'c080afa4237fd947e4d593584568a81b576938463ed6069d79057b0c4ab103ce' 
  AND (
    token = 'vivJeERu1zORDxoGfubwclNV4cc7TM05tsm4xA/oT5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022