UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bigo4pNWhbICxyuE9JMklUne+z7uwPpoOMOXtOCatyo=' 
WHERE 
  key_id = '9c7a5112502d98d73cedd5f482b30cff47ee46f3773c1b0b1ac0978df2b3208b' 
  AND (
    token = 'bigo4pNWhbICxyuE9JMklUne+z7uwPpoOMOXtOCatyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054