UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fk9VfOkM+BAy/vzEvl4QOOIGikCsyNKIr3GPc6R/gg8=' 
WHERE 
  key_id = '66b6cb1131aef197de539a0e0e158a9736f397c4b1e325272d33ed007bc58b36' 
  AND (
    token = 'Fk9VfOkM+BAy/vzEvl4QOOIGikCsyNKIr3GPc6R/gg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030