UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZ+5ddBSGcpd5iQE2QxJh5NihqUKM9rrPJa04IPmVBM=' 
WHERE 
  key_id = '14a2d62c0887d438794ccde437bf39499e432fc1fc5fae2dab79df2a2089df54' 
  AND (
    token = 'XZ+5ddBSGcpd5iQE2QxJh5NihqUKM9rrPJa04IPmVBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049