UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mSfGqBLx1nQnsdv/gXHWisskZjqxbBZV3DdIeYmqtu8=' 
WHERE 
  key_id = 'a8a93a5c787d8b77759c360a54d24f38b2555993ec7867fa301cf1b561610045' 
  AND (
    token = 'mSfGqBLx1nQnsdv/gXHWisskZjqxbBZV3DdIeYmqtu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032