UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f+fEfsxMPuIENiVM5PI3NBiUl4HD3SZyicI6JH9jqr4=' 
WHERE 
  key_id = '5da7188fa87f7f0d5008d40bab04cb906ccf152734563bb99f5f7331a013a79b' 
  AND (
    token = 'f+fEfsxMPuIENiVM5PI3NBiUl4HD3SZyicI6JH9jqr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032