UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y+WiJDUy72C1Yjbgy1NNAmXyMpAYXqwMS/UPQ9mrQGo=' 
WHERE 
  key_id = 'd8f3b3b11a4e958a014ebb3ca5b2583644f688715cafbb3ea7f4a17a6e2bad09' 
  AND (
    token = 'y+WiJDUy72C1Yjbgy1NNAmXyMpAYXqwMS/UPQ9mrQGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029