UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9L1hw+VrO/7RGCJmfJK2u76MzcvvH0qnqnFK3oOx8B4=' 
WHERE 
  key_id = '0b8ecea00c906fead16905d67e8745245a325c899e72a9bd90c87137947270ce' 
  AND (
    token = '9L1hw+VrO/7RGCJmfJK2u76MzcvvH0qnqnFK3oOx8B4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029