UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PDWXtoEoqEezA5jkJBy8hQ+iU2qCKpU0Upx6uLAH0AQ=' 
WHERE 
  key_id = 'd929cef969e7520615740d7d6946ab4bc4baa148a5c122495ed65e1c6b34028a' 
  AND (
    token = 'PDWXtoEoqEezA5jkJBy8hQ+iU2qCKpU0Upx6uLAH0AQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043