UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v40DFcJZORGHvliGV2UmHtXXuB+D9RfdtUXYVxol2rs=' 
WHERE 
  key_id = 'd9d19615df7bcb37fd07483c8310af1395fef047b0bdc5ea7644b8170c55025e' 
  AND (
    token = 'v40DFcJZORGHvliGV2UmHtXXuB+D9RfdtUXYVxol2rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028