UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y/Sat42LBZkXaqfRWGqQB7UHEhUhw4EudJZhECMAvpk=' 
WHERE 
  key_id = '3bc298051872f626f1d14f1d0b6d37a214370bccfe33261555e952d05b64da06' 
  AND (
    token = 'y/Sat42LBZkXaqfRWGqQB7UHEhUhw4EudJZhECMAvpk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032