UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0F2w4k2BGLqQHXcyjAQnkO4+rQ9wn+MbHYNdzW6Ot1I=' 
WHERE 
  key_id = 'f23450478a6b831d318130c5f5889320c5eeea1df11301f1fb432059f748022e' 
  AND (
    token = '0F2w4k2BGLqQHXcyjAQnkO4+rQ9wn+MbHYNdzW6Ot1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051