UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQx4ZsXyS+6dTvYV7WdXXYXfNj5yuqzsqUHyZ/bK4nM=' 
WHERE 
  key_id = 'e91a73e8c0d6152254b966955c6709708150ac3383de20c890aad8ee061fbd88' 
  AND (
    token = 'KQx4ZsXyS+6dTvYV7WdXXYXfNj5yuqzsqUHyZ/bK4nM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022