UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JJwAM2+1/+ApjgunqVQzwcPa5JHkjRpaYhqlvtsd/IE=' 
WHERE 
  key_id = '7018e51b38db5e6c788cb91cf235adacdfe2d724b0511c52fd6d2787bafc789c' 
  AND (
    token = 'JJwAM2+1/+ApjgunqVQzwcPa5JHkjRpaYhqlvtsd/IE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038