UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pk7KcxVX6NCd+nY8JOneUcpSgC3Hpj8a1jA/UqcXOCE=' 
WHERE 
  key_id = 'f6fd4eab492bf7bef96bb0726c1058cbb7623723fe3aa7804d75387bf61bc76c' 
  AND (
    token = 'pk7KcxVX6NCd+nY8JOneUcpSgC3Hpj8a1jA/UqcXOCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036