UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CbFE+DUp7B7BYsygK+9HTxxMYqBr1PXrLAB6OS/cOiA=' 
WHERE 
  key_id = '3efc2c67f9e66127d1b742618c271d4b1d937c5c0d016697a796513066cf4713' 
  AND (
    token = 'CbFE+DUp7B7BYsygK+9HTxxMYqBr1PXrLAB6OS/cOiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052