UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'egKTOoChAKj3dzBMkN0K3Q25O1xSeEoigBY2zA0JysA=' 
WHERE 
  key_id = '513dcde262e3719cd188e45ecadaa129115ab33af0e461420d4fd0e2add9c7a1' 
  AND (
    token = 'egKTOoChAKj3dzBMkN0K3Q25O1xSeEoigBY2zA0JysA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039