UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n92OmRDdzKtP1cedP9a/Ca5LUVOu3OCUZsfAT15QnoQ=' 
WHERE 
  key_id = '12b7825c1dce90e529e7a44cf3df69419cf14a9474ecad62c40a66e872a0e8f0' 
  AND (
    token = 'n92OmRDdzKtP1cedP9a/Ca5LUVOu3OCUZsfAT15QnoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059