UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xD3BxgJK4IA69PtMGwb+F2aNJS+itV0kOnxNSnKl8lE=' 
WHERE 
  key_id = 'f819664b62cb0f09331a510a06c75e45deb3cf39cd88a567806ba480db32948e' 
  AND (
    token = 'xD3BxgJK4IA69PtMGwb+F2aNJS+itV0kOnxNSnKl8lE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031