UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UIVOPqNVOT1oOdqAnGPGLCTwwk1RQ6Xx3xS9xi37T8U=' 
WHERE 
  key_id = '22d9c1bf2da14f1af9e199958189c61d92b2b336140c1123cb4519a3d1df9bd9' 
  AND (
    token = 'UIVOPqNVOT1oOdqAnGPGLCTwwk1RQ6Xx3xS9xi37T8U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037