UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'deMtw/d1gFE/3fATu7IvU0HVav56iv0Bu5pSOYy6NYs=' 
WHERE 
  key_id = '71a9768960f4da79e61b1782849bd26322b12428c14e5da5e573032127f26624' 
  AND (
    token = 'deMtw/d1gFE/3fATu7IvU0HVav56iv0Bu5pSOYy6NYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048