UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ThdPQMVVQgpit3FCNtww2CTzFKZLXihLV9dJKtzb4E0=' 
WHERE 
  key_id = '95f1d4666af2ec3149285f4e91a08a92532e23f86d50c90d59473ef118f6a765' 
  AND (
    token = 'ThdPQMVVQgpit3FCNtww2CTzFKZLXihLV9dJKtzb4E0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023