UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N3MLkT8Lh7z7Lg2/7AvVJrCc2MheSWzj5VDzHwF1dRw=' 
WHERE 
  key_id = '323f0a39f6c0824f881d302b83648f26ec3983b5c35833b199489db6ddd35588' 
  AND (
    token = 'N3MLkT8Lh7z7Lg2/7AvVJrCc2MheSWzj5VDzHwF1dRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048