UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pLu/D+DXlrmu/lK2snuCc3Mylweb2coZykvxbKj78jQ=' 
WHERE 
  key_id = '5b01e57ed7c4692d776fee50f010b64c7da1e692491a591190b8024d12a99ca2' 
  AND (
    token = 'pLu/D+DXlrmu/lK2snuCc3Mylweb2coZykvxbKj78jQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032